﻿using System;
using System.Runtime.InteropServices;
using System.Windows;

namespace AdTech.Snap.Interop
{
    [StructLayout(LayoutKind.Sequential)]
    internal struct MARGINS
    {
        public int Left;
        public int Right;
        public int Top;
        public int Bottom;

        public MARGINS(int left, int top, int right, int bottom)
        {
            this.Left = left;
            this.Top = top;
            this.Right = right;
            this.Bottom = bottom;
        }

        public static implicit operator Thickness(MARGINS margin)
        {
            return new Thickness(margin.Left, margin.Top, margin.Right, margin.Bottom);
        }

        public static implicit operator MARGINS(Thickness rectangle)
        {
            int left = Convert.ToInt32(rectangle.Left);
            int top = Convert.ToInt32(rectangle.Top);
            int right = Convert.ToInt32(rectangle.Right);
            int bottom = Convert.ToInt32(rectangle.Bottom);
            return new MARGINS(left, top, right, bottom);
        }
    }
}
